-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite for React Hot Loader 3 #56
Conversation
try { | ||
// Create a proxy constructor with matching name | ||
ProxyComponent = new Function('factory', 'instantiate', | ||
`return function ${InitialComponent.name || 'ProxyComponent'}() { | ||
`return function ${displayName}() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gaearon this appears to cause an issue with Redux, it tries to evaluate Connect(ComponentName)
as a function name and it results in a silent SyntaxError. It only shows up if you run with Pause On Caught Exceptions and no other error in console. Is it necessary to sanitize the function name?
There is a reasonable fallback here. No further action might be necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, we should sanitize it. Would you like to send a PR against 3.x branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do what I can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made an attempt here #58
I think this will actually make it easier for me to use a Proxy here because this is where I ended up spinning my wheels last time |
Oh, cool, would be excited to see that @danmartinez101 😄 |
How would you feel about exposing a lifecycle hook for when a proxy is updated? I'm trying to find a nice way of having methods rebind to the instance when using ES6 Classes. |
Changes related to the “wrap during
createElement
” approach described here:this.constructor
, not the proxy classupdate()
, static properties created dynamically on the previous class get copied to the next classExample of this in action: gaearon/react-hot-boilerplate#61